import time
import sys
import io
from alg import is_additive_number

# 防止中文乱码
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')

def test():
    cases = [
        ("112358", True),
        ("199100199", True),
        ("123", True),
        ("1023", False),
        ("101", True),
        ("1203", False),
        ("000", True),
        ("199100199100298", True)
    ]

    print("开始测试...\n")
    for s, expected in cases:
        start = time.time()
        result = is_additive_number(s)
        end = time.time()
        print(f"输入: {s}")
        print(f"预期输出: {expected}")
        print(f"实际输出: {result}")
        print(f"执行时间: {round((end - start) * 1000, 2)} ms\n")

if __name__ == "__main__":
    test()
